//
//  ViewController.m
//  DemoLocalNotification
//
//  Created by 唐可雄 on 16/5/31.
//  Copyright © 2016年 swustyc. All rights reserved.
//

#import "ViewController.h"

@interface ViewController () {
    UILocalNotification *_notification;
}

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)rssBtnDidClick:(id)sender {
    _notification = [[UILocalNotification alloc] init];
    _notification.fireDate = [NSDate dateWithTimeIntervalSinceNow:10];
    _notification.timeZone = [NSTimeZone defaultTimeZone];
    _notification.repeatInterval = NSCalendarUnitMinute;
    _notification.alertBody = @"这是一个通知";
    _notification.soundName = UILocalNotificationDefaultSoundName;
    [[UIApplication sharedApplication] scheduleLocalNotification:_notification];
    _notification.userInfo = @{@"key":@"name"};
}

- (IBAction)cancelBtnDidClick:(id)sender {
    [[UIApplication sharedApplication] cancelLocalNotification:_notification];
}

@end
